package org.delphy.indy2.controls.carbonTextInputClasses
{
	import flash.events.*;
	import flash.filters.*;
	
	import mx.controls.Button;

	public class CarbonMagnifyButton extends Button
	{
		public var glowFilter:GlowFilter;
		public var shadowFilter:DropShadowFilter;
		public var bevelFilter:BevelFilter;
		public var innerGlowFilter:GlowFilter;		
		
		public function CarbonMagnifyButton()
		{
			super();
			
			styleName="carbonMagnifyButton";
			
			glowFilter=new GlowFilter();
			shadowFilter=new DropShadowFilter();
			bevelFilter=new BevelFilter();
			innerGlowFilter=new GlowFilter();			
			
			addEventListener(MouseEvent.ROLL_OVER,onMagnifyRollOver);
			addEventListener(MouseEvent.ROLL_OUT,onMagnifyRollOut);
		}
		
		private function onMagnifyRollOver(evt:MouseEvent):void{
			filters=[bevelFilter,innerGlowFilter,glowFilter];
		}
		private function onMagnifyRollOut(evt:MouseEvent):void{
			filters=[bevelFilter,shadowFilter];
		}		
		
		override protected function commitProperties():void{
			super.commitProperties();
			
			updateFilters();
			filters=[bevelFilter,shadowFilter];
		}
		
		public function updateFilters():void{
			glowFilter.blurX=getStyle("glowSize");
			glowFilter.blurY=getStyle("glowSize");
			glowFilter.alpha=getStyle("glowAlpha");
			glowFilter.color=getStyle("glowColor");			
			
			bevelFilter.angle=getStyle("bevelAngle");
			bevelFilter.blurX=getStyle("bevelSize");
			bevelFilter.blurY=getStyle("bevelSize");
			bevelFilter.distance=getStyle("bevelDistance");
			bevelFilter.highlightColor=getStyle("bevelHighlightColor");
			bevelFilter.highlightAlpha=getStyle("bevelHighlightAlpha");
			bevelFilter.shadowColor=getStyle("bevelShadowColor");
			bevelFilter.shadowAlpha=getStyle("bevelShadowAlpha");
							
			shadowFilter.blurX=getStyle("shadowSize");
			shadowFilter.blurY=getStyle("shadowSize");
			shadowFilter.distance=getStyle("shadowDistance");
			shadowFilter.angle=getStyle("shadowAngle");
			shadowFilter.alpha=getStyle("shadowAlpha");
			shadowFilter.color=getStyle("shadowColor");
			
			innerGlowFilter.inner=true;
			innerGlowFilter.blurX=getStyle("innerGlowSize");
			innerGlowFilter.blurY=getStyle("innerGlowSize");
			innerGlowFilter.alpha=getStyle("innerGlowAlpha");
			innerGlowFilter.color=getStyle("innerGlowColor");
			
		}

	}
}